package com.yunhe.authority.domain.authority;

import com.yunhe.common.annotation.EnumItemCode;
import com.yunhe.common.annotation.NameTitle;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.neo4j.ogm.annotation.GeneratedValue;
import org.neo4j.ogm.annotation.Id;
import org.neo4j.ogm.annotation.NodeEntity;

import java.io.Serializable;
import java.util.List;

/**
 * 菜单对象
 * @desc 菜单对象定义
 * @author liuronglei
 */
@ApiModel(value = "Menu", description = "菜单对象")
@NodeEntity
public class Menu implements Comparable<Menu>, Serializable {
    @ApiModelProperty(value = "菜单ID")
    @Id
    @GeneratedValue
    private Long id;
    @ApiModelProperty(value = "菜单名")
    private String name;
    @ApiModelProperty(value = "标题")
    private String title;
    @ApiModelProperty(value = "Url")
    private String url;
    @ApiModelProperty(value = "图标")
    private String icon;
    @ApiModelProperty(value = "子菜单", hidden = true)
//    @Relationship(type = "HAS_CHILD")
    private List<Menu> children;
    @ApiModelProperty(value = "是否是根节点 0否 1是")
    private String root = "1";
    @ApiModelProperty(value = "是否可用 0不可用 1可用")
    private String activity = "1";
    @ApiModelProperty(value = "排序序号")
    private String sn;
    @ApiModelProperty(value = "父级菜单ID")
    private Long parentId;

    @ApiModelProperty(value = "是否启用")
    private boolean enable;

    @ApiModelProperty(value = "系统菜单类目")
    /**1智慧园区管理web端 2智慧园区管理移动端(app) 3智慧园区服务移动端(小程序) 4后台菜单*/
    private String systemMenuCategory;

    @ApiModelProperty(value = "菜单所属大类title")
    @NameTitle(nameCode = "menuBelongType",nameType = "ITEM")
    private String menuBelongTypeTitle;
    @ApiModelProperty(value = "菜单所属大类id")
    private String menuBelongType;

    @ApiModelProperty(value = "置顶时间")
    private String topTime;

    @Override
    public int compareTo(Menu o) {
        if (this.sn == null) {
            return -1;
        } else if (o.getSn() == null) {
            return 1;
        }
        return this.sn.compareTo(o.getSn());
    }

    public String getSn() {
        return sn;
    }

    public void setSn(String sn) {
        this.sn = sn;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public List<Menu> getChildren() {
        return children;
    }

    public void setChildren(List<Menu> children) {
        this.children = children;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRoot() {
        return root;
    }

    public void setRoot(String root) {
        this.root = root;
    }

    public String getActivity() {
        return activity;
    }

    public void setActivity(String activity) {
        this.activity = activity;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public boolean getEnable() {
        return enable;
    }

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public String getSystemMenuCategory() {
        return systemMenuCategory;
    }

    public void setSystemMenuCategory(String systemMenuCategory) {
        this.systemMenuCategory = systemMenuCategory;
    }

    public String getTopTime() {
        return topTime;
    }

    public void setTopTime(String topTime) {
        this.topTime = topTime;
    }

    public String getMenuBelongTypeTitle() {
        return menuBelongTypeTitle;
    }

    public void setMenuBelongTypeTitle(String menuBelongTypeTitle) {
        this.menuBelongTypeTitle = menuBelongTypeTitle;
    }

    public String getMenuBelongType() {
        return menuBelongType;
    }

    public void setMenuBelongType(String menuBelongType) {
        this.menuBelongType = menuBelongType;
    }
}
